package com.moji.controller.web;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.moji.common.base.ApiResult;
import com.moji.common.entity.MyPage;
import com.moji.entity.MjAgreement;
import com.moji.entity.MjApplaction;
import com.moji.entity.MjBasicInfo;
import com.moji.entity.dto.MjAgreementDto;
import com.moji.entity.vo.CommonBasicDTO;
import com.moji.service.MjApplactionService;
import com.moji.service.MjBasicInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 申请理由表 前端控制器
 * </p>
 *
 * @author ccl
 * @since 2024-08-26
 */
@RestController
@RequestMapping("web/mjApplaction")
@Api(tags = "申请理由相关接口", value = "申请理由相关接口")
public class MjApplactionController {
    @Resource
    private MjApplactionService mjApplactionService;
    @PostMapping("/queryApplactionByType")
    @ApiOperation(value = "获取申请理由,默认传Int类型的type，1-退款，没有传type则返回全部", response = MjApplaction.class)
    public ApiResult<List<MjApplaction>> queryApplactionByType(@RequestBody MjAgreementDto dto) {
        LambdaQueryWrapper<MjApplaction> queryWrapper = new LambdaQueryWrapper<>();
        if (dto.getType() != null) {
            queryWrapper.eq(MjApplaction::getApplactionType, dto.getType());
        }
        List<MjApplaction> list = mjApplactionService.list(queryWrapper);
        return ApiResult.ok(list);
    }
}

